﻿using System;
using System.Collections.Generic;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.nodes.hive;
using SharpSqlAnalyzer.nodes.mssql;
using SharpSqlAnalyzer.nodes.teradata;

namespace SharpSqlAnalyzer.stmt
{
	// Token: 0x020000BE RID: 190
	public class TSelectSqlStatement : TCustomSqlStatement
	{
		// Token: 0x1700011E RID: 286
		// (get) Token: 0x0600068F RID: 1679 RVA: 0x002FEA41 File Offset: 0x002FCC41
		// (set) Token: 0x06000690 RID: 1680 RVA: 0x002FEA49 File Offset: 0x002FCC49
		public bool childOfCombinedQuery
		{
			get
			{
				return this._childOfCombinedQuery;
			}
			set
			{
				this._childOfCombinedQuery = value;
			}
		}

		// Token: 0x1700011F RID: 287
		// (get) Token: 0x06000692 RID: 1682 RVA: 0x002FEA5B File Offset: 0x002FCC5B
		// (set) Token: 0x06000691 RID: 1681 RVA: 0x002FEA52 File Offset: 0x002FCC52
		public virtual TFetchFirstClause FetchFirstClause
		{
			get
			{
				return this._fetchFirstClause;
			}
			set
			{
				this._fetchFirstClause = value;
			}
		}

		// Token: 0x17000120 RID: 288
		// (get) Token: 0x06000694 RID: 1684 RVA: 0x002FEA6C File Offset: 0x002FCC6C
		// (set) Token: 0x06000693 RID: 1683 RVA: 0x002FEA63 File Offset: 0x002FCC63
		public virtual int ParenthesisCount
		{
			get
			{
				return this._parenthesisCount;
			}
			set
			{
				this._parenthesisCount = value;
			}
		}

		// Token: 0x17000121 RID: 289
		// (get) Token: 0x06000696 RID: 1686 RVA: 0x002FEA7D File Offset: 0x002FCC7D
		// (set) Token: 0x06000695 RID: 1685 RVA: 0x002FEA74 File Offset: 0x002FCC74
		public virtual int ParenthesisCountBeforeOrder
		{
			get
			{
				return this._parenthesisCountBeforeOrder;
			}
			set
			{
				this._parenthesisCountBeforeOrder = value;
			}
		}

		// Token: 0x17000122 RID: 290
		// (get) Token: 0x06000698 RID: 1688 RVA: 0x002FEA8E File Offset: 0x002FCC8E
		// (set) Token: 0x06000697 RID: 1687 RVA: 0x002FEA85 File Offset: 0x002FCC85
		public virtual bool All
		{
			get
			{
				return this._all;
			}
			set
			{
				this._all = value;
			}
		}

		// Token: 0x17000123 RID: 291
		// (get) Token: 0x0600069A RID: 1690 RVA: 0x002FEA9F File Offset: 0x002FCC9F
		// (set) Token: 0x06000699 RID: 1689 RVA: 0x002FEA96 File Offset: 0x002FCC96
		public virtual ESetOperatorType SetOperatorType
		{
			get
			{
				return this._setOperatorType;
			}
			set
			{
				this._setOperatorType = value;
			}
		}

		// Token: 0x17000124 RID: 292
		// (get) Token: 0x0600069C RID: 1692 RVA: 0x002FEAB0 File Offset: 0x002FCCB0
		// (set) Token: 0x0600069B RID: 1691 RVA: 0x002FEAA7 File Offset: 0x002FCCA7
		public virtual TWindowClause WindowClause
		{
			get
			{
				return this._windowClause;
			}
			set
			{
				this._windowClause = value;
			}
		}

		// Token: 0x17000125 RID: 293
		// (get) Token: 0x0600069E RID: 1694 RVA: 0x002FEAC1 File Offset: 0x002FCCC1
		// (set) Token: 0x0600069D RID: 1693 RVA: 0x002FEAB8 File Offset: 0x002FCCB8
		public virtual List<TLockingClause> LockingClauses
		{
			get
			{
				return this._lockingClauses;
			}
			set
			{
				this._lockingClauses = value;
			}
		}

		// Token: 0x17000126 RID: 294
		// (get) Token: 0x060006A0 RID: 1696 RVA: 0x002FEAD2 File Offset: 0x002FCCD2
		// (set) Token: 0x0600069F RID: 1695 RVA: 0x002FEAC9 File Offset: 0x002FCCC9
		public virtual TSelectDistinct SelectDistinct
		{
			get
			{
				return this._selectDistinct;
			}
			set
			{
				this._selectDistinct = value;
			}
		}

		// Token: 0x17000127 RID: 295
		// (get) Token: 0x060006A2 RID: 1698 RVA: 0x002FEAE3 File Offset: 0x002FCCE3
		// (set) Token: 0x060006A1 RID: 1697 RVA: 0x002FEADA File Offset: 0x002FCCDA
		public virtual TExpandOnClause ExpandOnClause
		{
			get
			{
				return this._expandOnClause;
			}
			set
			{
				this._expandOnClause = value;
			}
		}

		// Token: 0x17000128 RID: 296
		// (get) Token: 0x060006A4 RID: 1700 RVA: 0x002FEAF4 File Offset: 0x002FCCF4
		// (set) Token: 0x060006A3 RID: 1699 RVA: 0x002FEAEB File Offset: 0x002FCCEB
		public virtual int SetOperator
		{
			get
			{
				return this._setOperator;
			}
			set
			{
				this._setOperator = value;
			}
		}

		// Token: 0x17000129 RID: 297
		// (get) Token: 0x060006A6 RID: 1702 RVA: 0x002FEB05 File Offset: 0x002FCD05
		// (set) Token: 0x060006A5 RID: 1701 RVA: 0x002FEAFC File Offset: 0x002FCCFC
		public virtual TSelectSqlStatement LeftStmt
		{
			get
			{
				return this._leftStmt;
			}
			set
			{
				this._leftStmt = value;
			}
		}

		// Token: 0x1700012A RID: 298
		// (get) Token: 0x060006A8 RID: 1704 RVA: 0x002FEB16 File Offset: 0x002FCD16
		// (set) Token: 0x060006A7 RID: 1703 RVA: 0x002FEB0D File Offset: 0x002FCD0D
		public virtual TSelectSqlStatement RightStmt
		{
			get
			{
				return this._rightStmt;
			}
			set
			{
				this._rightStmt = value;
			}
		}

		// Token: 0x1700012B RID: 299
		// (get) Token: 0x060006AA RID: 1706 RVA: 0x002FEB27 File Offset: 0x002FCD27
		// (set) Token: 0x060006A9 RID: 1705 RVA: 0x002FEB1E File Offset: 0x002FCD1E
		public virtual TValueClause ValueClause
		{
			get
			{
				return this._valueClause;
			}
			set
			{
				this._valueClause = value;
			}
		}

		// Token: 0x1700012C RID: 300
		// (get) Token: 0x060006AC RID: 1708 RVA: 0x002FEB38 File Offset: 0x002FCD38
		// (set) Token: 0x060006AB RID: 1707 RVA: 0x002FEB2F File Offset: 0x002FCD2F
		public virtual THiveHintClause HiveHintClause
		{
			get
			{
				return this._hiveHintClause;
			}
			set
			{
				this._hiveHintClause = value;
			}
		}

		// Token: 0x1700012D RID: 301
		// (get) Token: 0x060006AE RID: 1710 RVA: 0x002FEB49 File Offset: 0x002FCD49
		// (set) Token: 0x060006AD RID: 1709 RVA: 0x002FEB40 File Offset: 0x002FCD40
		public virtual THiveTransformClause TransformClause
		{
			get
			{
				return this._transformClause;
			}
			set
			{
				this._transformClause = value;
			}
		}

		// Token: 0x1700012E RID: 302
		// (get) Token: 0x060006B0 RID: 1712 RVA: 0x002FEB5A File Offset: 0x002FCD5A
		// (set) Token: 0x060006AF RID: 1711 RVA: 0x002FEB51 File Offset: 0x002FCD51
		public virtual THiveDistributeBy DistributeBy
		{
			get
			{
				return this._distributeBy;
			}
			set
			{
				this._distributeBy = value;
			}
		}

		// Token: 0x1700012F RID: 303
		// (get) Token: 0x060006B2 RID: 1714 RVA: 0x002FEB6B File Offset: 0x002FCD6B
		// (set) Token: 0x060006B1 RID: 1713 RVA: 0x002FEB62 File Offset: 0x002FCD62
		public virtual TIntoClause IntoClause
		{
			get
			{
				return this._intoClause;
			}
			set
			{
				this._intoClause = value;
			}
		}

		// Token: 0x17000130 RID: 304
		// (get) Token: 0x060006B4 RID: 1716 RVA: 0x002FEB7C File Offset: 0x002FCD7C
		// (set) Token: 0x060006B3 RID: 1715 RVA: 0x002FEB73 File Offset: 0x002FCD73
		public virtual TOrderBy OrderbyClause
		{
			get
			{
				return this._orderbyClause;
			}
			set
			{
				this._orderbyClause = value;
			}
		}

		// Token: 0x17000131 RID: 305
		// (get) Token: 0x060006B6 RID: 1718 RVA: 0x002FEB8D File Offset: 0x002FCD8D
		// (set) Token: 0x060006B5 RID: 1717 RVA: 0x002FEB84 File Offset: 0x002FCD84
		public virtual TQualifyClause QualifyClause
		{
			get
			{
				return this._qualifyClause;
			}
			set
			{
				this._qualifyClause = value;
			}
		}

		// Token: 0x17000132 RID: 306
		// (get) Token: 0x060006B8 RID: 1720 RVA: 0x002FEB9E File Offset: 0x002FCD9E
		// (set) Token: 0x060006B7 RID: 1719 RVA: 0x002FEB95 File Offset: 0x002FCD95
		public virtual TSampleClause SampleClause
		{
			get
			{
				return this._sampleClause;
			}
			set
			{
				this._sampleClause = value;
			}
		}

		// Token: 0x17000133 RID: 307
		// (get) Token: 0x060006BA RID: 1722 RVA: 0x002FEBAF File Offset: 0x002FCDAF
		// (set) Token: 0x060006B9 RID: 1721 RVA: 0x002FEBA6 File Offset: 0x002FCDA6
		public virtual TTeradataWithClause TeradataWithClause
		{
			get
			{
				return this._teradataWithClause;
			}
			set
			{
				this._teradataWithClause = value;
			}
		}

		// Token: 0x17000134 RID: 308
		// (get) Token: 0x060006BC RID: 1724 RVA: 0x002FEBC0 File Offset: 0x002FCDC0
		// (set) Token: 0x060006BB RID: 1723 RVA: 0x002FEBB7 File Offset: 0x002FCDB7
		public virtual TForUpdate ForUpdateClause
		{
			get
			{
				return this._forUpdateClause;
			}
			set
			{
				this._forUpdateClause = value;
			}
		}

		// Token: 0x17000135 RID: 309
		// (get) Token: 0x060006BE RID: 1726 RVA: 0x002FEBD1 File Offset: 0x002FCDD1
		// (set) Token: 0x060006BD RID: 1725 RVA: 0x002FEBC8 File Offset: 0x002FCDC8
		public virtual TComputeClause ComputeClause
		{
			get
			{
				return this._computeClause;
			}
			set
			{
				this._computeClause = value;
			}
		}

		// Token: 0x17000136 RID: 310
		// (get) Token: 0x060006C0 RID: 1728 RVA: 0x002FEBE2 File Offset: 0x002FCDE2
		// (set) Token: 0x060006BF RID: 1727 RVA: 0x002FEBD9 File Offset: 0x002FCDD9
		public virtual TGroupBy GroupByClause
		{
			get
			{
				return this._groupByClause;
			}
			set
			{
				this._groupByClause = value;
			}
		}

		// Token: 0x17000137 RID: 311
		// (get) Token: 0x060006C2 RID: 1730 RVA: 0x002FEBF3 File Offset: 0x002FCDF3
		// (set) Token: 0x060006C1 RID: 1729 RVA: 0x002FEBEA File Offset: 0x002FCDEA
		public virtual THierarchical HierarchicalClause
		{
			get
			{
				return this._hierarchicalClause;
			}
			set
			{
				this._hierarchicalClause = value;
			}
		}

		// Token: 0x17000138 RID: 312
		// (get) Token: 0x060006C4 RID: 1732 RVA: 0x002FEC04 File Offset: 0x002FCE04
		// (set) Token: 0x060006C3 RID: 1731 RVA: 0x002FEBFB File Offset: 0x002FCDFB
		public virtual TLimitClause LimitClause
		{
			get
			{
				return this._limitClause;
			}
			set
			{
				this._limitClause = value;
			}
		}

		// Token: 0x17000139 RID: 313
		// (get) Token: 0x060006C6 RID: 1734 RVA: 0x002FEC15 File Offset: 0x002FCE15
		// (set) Token: 0x060006C5 RID: 1733 RVA: 0x002FEC0C File Offset: 0x002FCE0C
		public virtual TOffsetClause OffsetClause
		{
			get
			{
				return this._offsetClause;
			}
			set
			{
				this._offsetClause = value;
			}
		}

		// Token: 0x1700013A RID: 314
		// (get) Token: 0x060006C8 RID: 1736 RVA: 0x002FEC26 File Offset: 0x002FCE26
		// (set) Token: 0x060006C7 RID: 1735 RVA: 0x002FEC1D File Offset: 0x002FCE1D
		public virtual TOptionClause OptionClause
		{
			get
			{
				return this._optionClause;
			}
			set
			{
				this._optionClause = value;
			}
		}

		// Token: 0x1700013B RID: 315
		// (get) Token: 0x060006CA RID: 1738 RVA: 0x002FEC37 File Offset: 0x002FCE37
		// (set) Token: 0x060006C9 RID: 1737 RVA: 0x002FEC2E File Offset: 0x002FCE2E
		public virtual TIsolationClause IsolationClause
		{
			get
			{
				return this._isolationClause;
			}
			set
			{
				this._isolationClause = value;
			}
		}

		// Token: 0x1700013C RID: 316
		// (get) Token: 0x060006CC RID: 1740 RVA: 0x002FEC48 File Offset: 0x002FCE48
		// (set) Token: 0x060006CB RID: 1739 RVA: 0x002FEC3F File Offset: 0x002FCE3F
		public virtual THiveClusterBy HiveClusterBy
		{
			get
			{
				return this._hiveClusterBy;
			}
			set
			{
				this._hiveClusterBy = value;
			}
		}

		// Token: 0x1700013D RID: 317
		// (get) Token: 0x060006CE RID: 1742 RVA: 0x002FEC59 File Offset: 0x002FCE59
		// (set) Token: 0x060006CD RID: 1741 RVA: 0x002FEC50 File Offset: 0x002FCE50
		public virtual THiveSortBy SortBy
		{
			get
			{
				return this._sortBy;
			}
			set
			{
				this._sortBy = value;
			}
		}

		// Token: 0x1700013E RID: 318
		// (get) Token: 0x060006D0 RID: 1744 RVA: 0x002FEC6A File Offset: 0x002FCE6A
		// (set) Token: 0x060006CF RID: 1743 RVA: 0x002FEC61 File Offset: 0x002FCE61
		public virtual TIntoTableClause IntoTableClause
		{
			get
			{
				return this._intoTableClause;
			}
			set
			{
				this._intoTableClause = value;
			}
		}

		// Token: 0x1700013F RID: 319
		// (get) Token: 0x060006D2 RID: 1746 RVA: 0x002FEC7B File Offset: 0x002FCE7B
		// (set) Token: 0x060006D1 RID: 1745 RVA: 0x002FEC72 File Offset: 0x002FCE72
		public virtual bool QueryOfCTE
		{
			get
			{
				return this._queryOfCTE;
			}
			set
			{
				this._queryOfCTE = value;
			}
		}

		// Token: 0x17000140 RID: 320
		// (get) Token: 0x060006D4 RID: 1748 RVA: 0x002FEC8C File Offset: 0x002FCE8C
		// (set) Token: 0x060006D3 RID: 1747 RVA: 0x002FEC83 File Offset: 0x002FCE83
		public virtual ESqlClause Location
		{
			get
			{
				return this._location;
			}
			set
			{
				this._location = value;
			}
		}

		// Token: 0x17000141 RID: 321
		// (get) Token: 0x060006D6 RID: 1750 RVA: 0x002FEC9D File Offset: 0x002FCE9D
		// (set) Token: 0x060006D5 RID: 1749 RVA: 0x002FEC94 File Offset: 0x002FCE94
		public virtual TSourceToken SelectToken
		{
			get
			{
				return this._selectToken;
			}
			set
			{
				this._selectToken = value;
			}
		}

		// Token: 0x060006D7 RID: 1751 RVA: 0x002FECA5 File Offset: 0x002FCEA5
		public TSelectSqlStatement(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstselect;
		}

		// Token: 0x060006D8 RID: 1752 RVA: 0x002FECB5 File Offset: 0x002FCEB5
		internal override void buildsql()
		{
		}

		// Token: 0x060006D9 RID: 1753 RVA: 0x002FECB7 File Offset: 0x002FCEB7
		internal override void clear()
		{
		}

		// Token: 0x060006DA RID: 1754 RVA: 0x002FECB9 File Offset: 0x002FCEB9
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x060006DB RID: 1755 RVA: 0x002FECC0 File Offset: 0x002FCEC0
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x060006DC RID: 1756 RVA: 0x002FECC4 File Offset: 0x002FCEC4
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			TSelectSqlNode tselectSqlNode = (TSelectSqlNode)this.rootNode;
			if (this.sourcetokenlist.size() == 0)
			{
				base.startToken = tselectSqlNode.startToken;
				base.endToken = tselectSqlNode.endToken;
			}
			base.doParseStatement(psql);
			this._selectToken = tselectSqlNode.SelectToken;
			this._parenthesisCount = tselectSqlNode.ParenthesisCount;
			this._parenthesisCountBeforeOrder = tselectSqlNode.ParenthissisCountBeforeOrder;
			this._setOperator = tselectSqlNode.SetOperator;
			switch (this._setOperator)
			{
			case 0:
				this._setOperatorType = ESetOperatorType.none;
				this._all = false;
				break;
			case 1:
				this._setOperatorType = ESetOperatorType.union;
				this._all = false;
				break;
			case 2:
				this._setOperatorType = ESetOperatorType.union;
				this._all = true;
				break;
			case 3:
				this._setOperatorType = ESetOperatorType.intersect;
				this._all = false;
				break;
			case 4:
				this._setOperatorType = ESetOperatorType.intersect;
				this._all = true;
				break;
			case 5:
				this._setOperatorType = ESetOperatorType.minus;
				this._all = false;
				break;
			case 6:
				this._setOperatorType = ESetOperatorType.minus;
				this._all = true;
				break;
			case 7:
				this._setOperatorType = ESetOperatorType.except;
				this._all = false;
				break;
			case 8:
				this._setOperatorType = ESetOperatorType.except;
				this._all = true;
				break;
			}
			if (tselectSqlNode.CombinedQuery)
			{
				TCustomSqlStatement tcustomSqlStatement = psql;
				if (tcustomSqlStatement == null || !this.childOfCombinedQuery)
				{
					tcustomSqlStatement = this;
				}
				if (tselectSqlNode.cteList != null)
				{
					this.CteList = tselectSqlNode.cteList;
					for (int i = 0; i < this.CteList.size(); i++)
					{
						this.CteList.getCTE(i).doParse(this, ESqlClause.cte);
					}
				}
				this._leftStmt = new TSelectSqlStatement(this.dbvendor);
				this._leftStmt.rootNode = tselectSqlNode.LeftNode;
				this._leftStmt.childOfCombinedQuery = true;
				this._leftStmt.doParseStatement(tcustomSqlStatement);
				this._rightStmt = new TSelectSqlStatement(this.dbvendor);
				this._rightStmt.rootNode = tselectSqlNode.RightNode;
				this._rightStmt.childOfCombinedQuery = true;
				this._rightStmt.doParseStatement(tcustomSqlStatement);
				if (tselectSqlNode.OrderbyClause != null)
				{
					tselectSqlNode.OrderbyClause.doParse(this, ESqlClause.orderby);
					this._orderbyClause = tselectSqlNode.OrderbyClause;
				}
				this._limitClause = tselectSqlNode.LimitClause;
				if (tselectSqlNode.ForupdateClause != null)
				{
					tselectSqlNode.ForupdateClause.doParse(this, ESqlClause.forUpdate);
					this._forUpdateClause = tselectSqlNode.ForupdateClause;
				}
				if (tselectSqlNode.ComputeClause != null)
				{
					tselectSqlNode.ComputeClause.doParse(this, ESqlClause.compute);
					this._computeClause = tselectSqlNode.ComputeClause;
				}
				if (tselectSqlNode.IntoClause != null)
				{
					this._intoClause = tselectSqlNode.IntoClause;
					this._intoClause.doParse(this, ESqlClause.selectInto);
				}
				return 0;
			}
			if (tselectSqlNode.ValueClause != null)
			{
				this._valueClause = tselectSqlNode.ValueClause;
				this._valueClause.doParse(this, ESqlClause.selectValue);
				return 0;
			}
			if (tselectSqlNode.TransformClause != null)
			{
				this._transformClause = tselectSqlNode.TransformClause;
				this._transformClause.doParse(this, ESqlClause.transformClause);
			}
			if (tselectSqlNode.cteList != null)
			{
				this.CteList = tselectSqlNode.cteList;
				for (int j = 0; j < this.CteList.size(); j++)
				{
					this.CteList.getCTE(j).doParse(this, ESqlClause.cte);
				}
			}
			base.scanOracleHint(this._selectToken);
			if (tselectSqlNode.HiveHintClause != null)
			{
				this._hiveHintClause = tselectSqlNode.HiveHintClause;
			}
			if (tselectSqlNode.TopClause != null)
			{
				tselectSqlNode.TopClause.doParse(this, ESqlClause.top);
				this.TopClause = tselectSqlNode.TopClause;
			}
			if (tselectSqlNode.SelectDistinct != null)
			{
				this._selectDistinct = tselectSqlNode.SelectDistinct;
			}
			if (tselectSqlNode.FromTableList != null)
			{
				for (int k = 0; k < tselectSqlNode.FromTableList.size(); k++)
				{
					TFromTable fromTable = tselectSqlNode.FromTableList.getFromTable(k);
					TJoin tjoin;
					if (fromTable.FromtableType != ETableSource.join)
					{
						tjoin = new TJoin();
						TTable ttable = this.analyzeFromTable(fromTable, new bool?(true));
						ttable.EffectType = ETableEffectType.tetSelect;
						tjoin.Table = ttable;
						tjoin.startToken = tjoin.Table.startToken;
						tjoin.endToken = tjoin.Table.endToken;
						tjoin.GSharpSqlParser = this.GSharpSqlParser;
					}
					else
					{
						tjoin = this.analyzeJoin(fromTable.JoinExpr, null, new bool?(true));
						tjoin.doParse(this, ESqlClause.join);
					}
					this.joins.addJoin(tjoin);
				}
			}
			if (tselectSqlNode.ResultColumnList != null)
			{
				tselectSqlNode.ResultColumnList.doParse(this, ESqlClause.selectList);
				this.ResultColumnList = tselectSqlNode.ResultColumnList;
			}
			if (tselectSqlNode.IntoClause != null)
			{
				this._intoClause = tselectSqlNode.IntoClause;
				this._intoClause.doParse(this, ESqlClause.selectInto);
			}
			if (tselectSqlNode.WhereCondition != null)
			{
				tselectSqlNode.WhereCondition.doParse(this, ESqlClause.where);
				this.WhereClause = tselectSqlNode.WhereCondition;
			}
			if (tselectSqlNode.HierarchicalClause != null)
			{
				tselectSqlNode.HierarchicalClause.doParse(this, ESqlClause.hierarchical);
				this._hierarchicalClause = tselectSqlNode.HierarchicalClause;
			}
			if (tselectSqlNode.GroupByClause != null)
			{
				tselectSqlNode.GroupByClause.doParse(this, ESqlClause.groupby);
				this._groupByClause = tselectSqlNode.GroupByClause;
			}
			if (tselectSqlNode.QualifyClause != null)
			{
				tselectSqlNode.QualifyClause.doParse(this, ESqlClause.qualify);
				this._qualifyClause = tselectSqlNode.QualifyClause;
			}
			if (tselectSqlNode.SampleClause != null)
			{
				tselectSqlNode.SampleClause.doParse(this, ESqlClause.sample);
				this._sampleClause = tselectSqlNode.SampleClause;
			}
			if (tselectSqlNode.ExpandOnClause != null)
			{
				tselectSqlNode.ExpandOnClause.doParse(this, ESqlClause.expandOn);
				this._expandOnClause = tselectSqlNode.ExpandOnClause;
			}
			if (tselectSqlNode.WithClause != null)
			{
				tselectSqlNode.WithClause.doParse(this, ESqlClause.teradataWith);
				this._teradataWithClause = tselectSqlNode.WithClause;
			}
			if (tselectSqlNode.OrderbyClause != null)
			{
				tselectSqlNode.OrderbyClause.doParse(this, ESqlClause.orderby);
				this._orderbyClause = tselectSqlNode.OrderbyClause;
			}
			if (tselectSqlNode.LockingClauses != null)
			{
				foreach (TLockingClause tlockingClause in tselectSqlNode.LockingClauses)
				{
					tlockingClause.doParse(this, ESqlClause.lockingClause);
				}
				this._lockingClauses = tselectSqlNode.LockingClauses;
			}
			this._sortBy = tselectSqlNode.SortBy;
			if (this._sortBy != null)
			{
				this._sortBy.doParse(this, ESqlClause.sortby);
			}
			this._windowClause = tselectSqlNode.WindowClause;
			if (this._windowClause != null)
			{
				this._windowClause.doParse(this, ESqlClause.windowClause);
			}
			this._limitClause = tselectSqlNode.LimitClause;
			if (this._limitClause != null)
			{
				this._limitClause.doParse(this, ESqlClause.limit);
			}
			if (tselectSqlNode.ForupdateClause != null)
			{
				tselectSqlNode.ForupdateClause.doParse(this, ESqlClause.forUpdate);
				this._forUpdateClause = tselectSqlNode.ForupdateClause;
			}
			if (tselectSqlNode.ComputeClause != null)
			{
				tselectSqlNode.ComputeClause.doParse(this, ESqlClause.compute);
				this._computeClause = tselectSqlNode.ComputeClause;
			}
			this._intoTableClause = tselectSqlNode.IntoTableClause;
			if (tselectSqlNode.DistributeBy != null)
			{
				this._distributeBy = tselectSqlNode.DistributeBy;
				this._distributeBy.doParse(this, ESqlClause.distributeBy);
			}
			this._hiveClusterBy = tselectSqlNode.HiveClusterBy;
			this._isolationClause = tselectSqlNode.IsolationClause;
			this._optionClause = tselectSqlNode.OptionClause;
			this._offsetClause = tselectSqlNode.OffsetClause;
			this._fetchFirstClause = tselectSqlNode.FetchFirstClause;
			return 0;
		}

		// Token: 0x17000142 RID: 322
		// (get) Token: 0x060006DD RID: 1757 RVA: 0x002FF3DC File Offset: 0x002FD5DC
		public virtual bool CombinedQuery
		{
			get
			{
				return this._setOperator > 0;
			}
		}

		// Token: 0x060006DE RID: 1758 RVA: 0x002FF3E7 File Offset: 0x002FD5E7
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x060006DF RID: 1759 RVA: 0x002FF3F8 File Offset: 0x002FD5F8
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.CombinedQuery)
			{
				if (this.CteList != null)
				{
					this.CteList.acceptChildren(v);
				}
				this._leftStmt.acceptChildren(v);
				this._rightStmt.acceptChildren(v);
				if (this.OrderbyClause != null)
				{
					this.OrderbyClause.acceptChildren(v);
				}
				if (this.LimitClause != null)
				{
					this.LimitClause.acceptChildren(v);
				}
				if (this.ForUpdateClause != null)
				{
					this.ForUpdateClause.acceptChildren(v);
				}
				if (this.ComputeClause != null)
				{
					this.ComputeClause.acceptChildren(v);
				}
				v.postVisit(this);
				return;
			}
			if (this.CteList != null)
			{
				this.CteList.acceptChildren(v);
			}
			if (this.TopClause != null)
			{
				this.TopClause.acceptChildren(v);
			}
			this.ResultColumnList.acceptChildren(v);
			if (this._intoClause != null)
			{
				this._intoClause.acceptChildren(v);
			}
			this.joins.acceptChildren(v);
			if (this.WhereClause != null)
			{
				this.WhereClause.acceptChildren(v);
			}
			if (this.HierarchicalClause != null)
			{
				this.HierarchicalClause.acceptChildren(v);
			}
			if (this.GroupByClause != null)
			{
				this.GroupByClause.acceptChildren(v);
			}
			if (this.QualifyClause != null)
			{
				this.QualifyClause.acceptChildren(v);
			}
			if (this.OrderbyClause != null)
			{
				this.OrderbyClause.acceptChildren(v);
			}
			if (this.LimitClause != null)
			{
				this.LimitClause.acceptChildren(v);
			}
			if (this.ForUpdateClause != null)
			{
				this.ForUpdateClause.acceptChildren(v);
			}
			if (this.ComputeClause != null)
			{
				this.ComputeClause.acceptChildren(v);
			}
			v.postVisit(this);
		}

		// Token: 0x060006E0 RID: 1760 RVA: 0x002FF596 File Offset: 0x002FD796
		[Obsolete("Method will be removed, please do not use it")]
		public virtual TOrderBy addOrderBy(string orderByStr)
		{
			return this.OrderbyClause;
		}

		// Token: 0x060006E1 RID: 1761 RVA: 0x002FF59E File Offset: 0x002FD79E
		public virtual TWhereClause addCondition(string condition)
		{
			return this.addWhereClause(condition);
		}

		// Token: 0x060006E2 RID: 1762 RVA: 0x002FF5A7 File Offset: 0x002FD7A7
		public virtual TWhereClause addConditionOR(string condition)
		{
			return this.addWhereClauseOR(condition);
		}

		// Token: 0x060006E3 RID: 1763 RVA: 0x002FF5B0 File Offset: 0x002FD7B0
		public override TWhereClause addWhereClause(string condition)
		{
			return this.doAddWhereClause(condition, true);
		}

		// Token: 0x060006E4 RID: 1764 RVA: 0x002FF5BA File Offset: 0x002FD7BA
		public virtual TWhereClause addWhereClauseOR(string condition)
		{
			return this.doAddWhereClause(condition, false);
		}

		// Token: 0x060006E5 RID: 1765 RVA: 0x002FF5C4 File Offset: 0x002FD7C4
		[Obsolete("Method will be removed, please do not use it")]
		protected internal virtual TWhereClause doAddWhereClause(string condition, bool isAnd)
		{
			return this.WhereClause;
		}

		// Token: 0x060006E6 RID: 1766 RVA: 0x002FF5CC File Offset: 0x002FD7CC
		public virtual bool searchColumnInResultSet(TObjectName pColumn, bool pMustIn)
		{
			bool flag = false;
			int num = 0;
			if (this.CombinedQuery)
			{
				flag = this._leftStmt.searchColumnInResultSet(pColumn, pMustIn);
				return this._rightStmt.searchColumnInResultSet(pColumn, pMustIn);
			}
			if (this.ResultColumnList == null)
			{
				return false;
			}
			for (int i = 0; i < this.ResultColumnList.size(); i++)
			{
				TResultColumn resultColumn = this.ResultColumnList.getResultColumn(i);
				flag = resultColumn.isMatchedWithResultColumn(pColumn);
				if (flag)
				{
					pColumn.SourceColumn = resultColumn;
					resultColumn.TargetColumns.addObjectName(pColumn);
					break;
				}
			}
			if (flag)
			{
				return true;
			}
			TResultColumn resultColumn2 = this.ResultColumnList.getResultColumn(0);
			TTable ttable;
			if (this.ResultColumnList.size() == 1 && resultColumn2.ToString().Equals("*", StringComparison.CurrentCultureIgnoreCase))
			{
				if (this.tables.size() == 1)
				{
					TTable table = this.tables.getTable(0);
					if (table.BaseTable)
					{
						flag = this.fireOnMetaDatabaseTableColumn(table.PrefixServer, table.PrefixDatabase, table.PrefixSchema, table.Name, pColumn.ColumnNameOnly);
						if (!flag)
						{
							num++;
						}
					}
					else if (table.TableType == ETableSource.subquery)
					{
						if (table.IncludeColumnAlias)
						{
							flag = table.searchColumnInAlias(pColumn);
						}
						else
						{
							flag = table.Subquery.searchColumnInResultSet(pColumn, pMustIn);
							if (!flag)
							{
								num++;
							}
						}
					}
					else if (table.CTEName)
					{
						flag = table.CTE.searchColumnInResultSet(this, table, pColumn, pMustIn);
						if (!flag)
						{
							num++;
						}
					}
					if (pMustIn)
					{
						flag = true;
					}
					if (flag)
					{
						table.LinkedColumns.addObjectName(pColumn);
						pColumn.SourceTable = table;
						pColumn.SourceColumn = resultColumn2;
						resultColumn2.TargetColumns.addObjectName(pColumn);
					}
				}
				else
				{
					num = 0;
					for (int j = 0; j < this.tables.size(); j++)
					{
						ttable = this.tables.getTable(j);
						if (ttable.BaseTable)
						{
							flag = this.fireOnMetaDatabaseTableColumn(ttable.PrefixServer, ttable.PrefixDatabase, ttable.PrefixSchema, ttable.Name, pColumn.ColumnNameOnly);
							if (!flag)
							{
								num++;
							}
						}
						else if (ttable.TableType == ETableSource.subquery)
						{
							if (ttable.IncludeColumnAlias)
							{
								flag = ttable.searchColumnInAlias(pColumn);
							}
							else
							{
								flag = ttable.Subquery.searchColumnInResultSet(pColumn, false);
								if (!flag)
								{
									num++;
								}
							}
						}
						else if (ttable.CTEName)
						{
							flag = ttable.CTE.searchColumnInResultSet(this, ttable, pColumn, false);
							if (!flag)
							{
								num++;
							}
						}
						if (flag)
						{
							ttable.LinkedColumns.addObjectName(pColumn);
							pColumn.SourceTable = ttable;
							pColumn.SourceColumn = resultColumn2;
							resultColumn2.TargetColumns.addObjectName(pColumn);
							break;
						}
					}
					if (!flag && pMustIn)
					{
						this.linkToFirstTable(pColumn, num);
					}
				}
			}
			if (flag)
			{
				return true;
			}
			int num2 = 0;
			for (int k = 0; k < this.ResultColumnList.size(); k++)
			{
				if (this.ResultColumnList.getResultColumn(k).ToString().Equals(".*", StringComparison.CurrentCultureIgnoreCase))
				{
					num2++;
				}
			}
			TResultColumn tresultColumn = null;
			ttable = null;
			for (int l = 0; l < this.ResultColumnList.size(); l++)
			{
				if (this.ResultColumnList.getResultColumn(l).ToString().Equals(".*", StringComparison.CurrentCultureIgnoreCase))
				{
					tresultColumn = this.ResultColumnList.getResultColumn(l);
					for (int m = 0; m < this.tables.size(); m++)
					{
						if (this.tables.getTable(m).equalByName(tresultColumn.PrefixTable))
						{
							ttable = this.tables.getTable(m);
							if (ttable.BaseTable)
							{
								flag = this.fireOnMetaDatabaseTableColumn(ttable.PrefixServer, ttable.PrefixDatabase, ttable.PrefixSchema, ttable.Name, pColumn.ColumnNameOnly);
								if (!flag)
								{
									num++;
								}
							}
							else if (ttable.TableType == ETableSource.subquery)
							{
								if (ttable.IncludeColumnAlias)
								{
									flag = ttable.searchColumnInAlias(pColumn);
								}
								else
								{
									flag = ttable.Subquery.searchColumnInResultSet(pColumn, pMustIn && num2 == 1);
									if (!flag)
									{
										num++;
									}
								}
							}
							else if (ttable.CTEName)
							{
								flag = ttable.CTE.searchColumnInResultSet(this, ttable, pColumn, pMustIn && num2 == 1);
								if (!flag)
								{
									num++;
								}
							}
							if (flag)
							{
								ttable.LinkedColumns.addObjectName(pColumn);
								pColumn.SourceTable = ttable;
								pColumn.SourceColumn = tresultColumn;
								tresultColumn.TargetColumns.addObjectName(pColumn);
								break;
							}
						}
					}
					if (flag)
					{
						break;
					}
				}
			}
			if (flag)
			{
				return true;
			}
			if (pMustIn && num2 == 1 && ttable != null)
			{
				ttable.LinkedColumns.addObjectName(pColumn);
				pColumn.SourceTable = ttable;
				pColumn.SourceColumn = tresultColumn;
				tresultColumn.TargetColumns.addObjectName(pColumn);
				flag = true;
			}
			if (flag)
			{
				return true;
			}
			if (pMustIn && num2 > 0)
			{
				flag = this.linkToFirstTable(pColumn, num);
			}
			return flag;
		}

		// Token: 0x04001198 RID: 4504
		private bool _childOfCombinedQuery;

		// Token: 0x04001199 RID: 4505
		private int _parenthesisCount;

		// Token: 0x0400119A RID: 4506
		private int _parenthesisCountBeforeOrder;

		// Token: 0x0400119B RID: 4507
		private bool _queryOfCTE;

		// Token: 0x0400119C RID: 4508
		private TFetchFirstClause _fetchFirstClause;

		// Token: 0x0400119D RID: 4509
		private TOffsetClause _offsetClause;

		// Token: 0x0400119E RID: 4510
		private TOptionClause _optionClause;

		// Token: 0x0400119F RID: 4511
		private ESqlClause _location;

		// Token: 0x040011A0 RID: 4512
		private TIsolationClause _isolationClause;

		// Token: 0x040011A1 RID: 4513
		private THiveClusterBy _hiveClusterBy;

		// Token: 0x040011A2 RID: 4514
		private THiveSortBy _sortBy;

		// Token: 0x040011A3 RID: 4515
		private TIntoTableClause _intoTableClause;

		// Token: 0x040011A4 RID: 4516
		private TSourceToken _selectToken;

		// Token: 0x040011A5 RID: 4517
		public const int setOperator_none = 0;

		// Token: 0x040011A6 RID: 4518
		public const int setOperator_union = 1;

		// Token: 0x040011A7 RID: 4519
		public const int setOperator_unionall = 2;

		// Token: 0x040011A8 RID: 4520
		public const int setOperator_intersect = 3;

		// Token: 0x040011A9 RID: 4521
		public const int setOperator_intersectall = 4;

		// Token: 0x040011AA RID: 4522
		public const int setOperator_minus = 5;

		// Token: 0x040011AB RID: 4523
		public const int setOperator_minusall = 6;

		// Token: 0x040011AC RID: 4524
		public const int setOperator_except = 7;

		// Token: 0x040011AD RID: 4525
		public const int setOperator_exceptall = 8;

		// Token: 0x040011AE RID: 4526
		private bool _all;

		// Token: 0x040011AF RID: 4527
		private ESetOperatorType _setOperatorType;

		// Token: 0x040011B0 RID: 4528
		private TWindowClause _windowClause;

		// Token: 0x040011B1 RID: 4529
		private List<TLockingClause> _lockingClauses;

		// Token: 0x040011B2 RID: 4530
		private TSelectDistinct _selectDistinct;

		// Token: 0x040011B3 RID: 4531
		private TIntoClause _intoClause;

		// Token: 0x040011B4 RID: 4532
		private TOrderBy _orderbyClause;

		// Token: 0x040011B5 RID: 4533
		private TQualifyClause _qualifyClause;

		// Token: 0x040011B6 RID: 4534
		private TSampleClause _sampleClause;

		// Token: 0x040011B7 RID: 4535
		private TTeradataWithClause _teradataWithClause;

		// Token: 0x040011B8 RID: 4536
		private TForUpdate _forUpdateClause;

		// Token: 0x040011B9 RID: 4537
		private TComputeClause _computeClause;

		// Token: 0x040011BA RID: 4538
		private TGroupBy _groupByClause;

		// Token: 0x040011BB RID: 4539
		private THierarchical _hierarchicalClause;

		// Token: 0x040011BC RID: 4540
		private TLimitClause _limitClause;

		// Token: 0x040011BD RID: 4541
		private TExpandOnClause _expandOnClause;

		// Token: 0x040011BE RID: 4542
		private int _setOperator;

		// Token: 0x040011BF RID: 4543
		private TSelectSqlStatement _leftStmt;

		// Token: 0x040011C0 RID: 4544
		private TSelectSqlStatement _rightStmt;

		// Token: 0x040011C1 RID: 4545
		private TValueClause _valueClause;

		// Token: 0x040011C2 RID: 4546
		private THiveHintClause _hiveHintClause;

		// Token: 0x040011C3 RID: 4547
		private THiveTransformClause _transformClause;

		// Token: 0x040011C4 RID: 4548
		private THiveDistributeBy _distributeBy;
	}
}
